home *** CD-ROM | disk | FTP | other *** search
/ Intel Web Outfitter Tool Kit 4 / Intel WebOutfitter Tool Kit Version 4.0.iso / public / Content / HAPTEK / ENG / CONTENT / vf3.js < prev    next >
Encoding:
JavaScript  |  2000-03-13  |  21.0 KB  |  780 lines

  1. ////////////////////////////////////////////////////////////////////
  2. // vf3.js Version 2 (August 19th, 1999)
  3. // -----------------------------------------------------------------
  4. // (c) 1999 Haptek, Inc.
  5.  
  6.  
  7. ////////////////////////////////////////////////////////////////////
  8. // Function QuickRef
  9. // -----------------------------------------------------------------
  10. // (parameters surrouned by braces, [], are optional)
  11. // See the note below about the 'code' parameter.
  12. //
  13. //
  14. // SendText(text[,box]) - sends 'text' to hypertext interpreter of plugin 
  15. // HapQuery(text[,box]) - ditto w/ query
  16. // VFBoxSelect(box) - selects a plugin instance to send commands to
  17. // VFBox(x, y[,commandfile]) - draws a box on the page x by y. Optionaly a local command file can be included
  18. // UseVFE(DLFN, code) - downloads and loads a VFE (if code is not specified, loads a local file, see src)
  19. // UseFile(DLFN, code) - ditto , w/ file
  20. // UseBackground(DLFN, code) - ditto w/ background
  21. // UseTexture(DLFN, code) - ditto w/ texture
  22. // UseMorph(morph [, code]) - ditto w/ morph If no code, then uses a standard morph. Downloading not tested!
  23. // UseNaturalVoice(DLFNwav, DLFNphn, code) - ditto w/ sound and phn file.
  24. // StartFile(thefile) - performs the \start hypertext command on 'thefile'
  25. // GrabFile(DLFN, code) - downloads a file (good for putting things in cache)
  26. // CleanUp([box]) - performs the \cleanup hypertext command
  27. // SetMaterial(i0, f0, f1, f2, f3) - changes material i0 w/ the f* values
  28. // SetAmbient(r, g, b, a) -
  29. // SetDiffuse(r, g, b, a) - 
  30. // SetEmissive(r, g, b, a) -
  31. // SetSpecular(r, g, b, a) -
  32. // SetSpecularPower(power) - 
  33. // Rotate(x, y, z, t) - just like the hypertext
  34. // Translate(x, y, z, t) - just like the hypertext
  35. // AddInitFile(box, name) - adds a scene file to be loaded to the vf 'box' as soon as the page is loaded
  36. // AddToInitQueue(string[,box]) - adds a string of javascript to be eval'ed as soon as the plugin is ready. 
  37. // HAPOnLoadInit() - function that must be put in the <BODY onLoad=> tag
  38. //
  39. // About the 'code' parameter:
  40. // 
  41. //   'code' is a way of specifying what sort of filename you have passed to 
  42. //   the downloading functions:
  43. //   'R'    Filename is relative to current webpage (ex: mybackground.jpg)
  44. //   'A'    Absolute URL or filename (ex: http://www.haptek.com/texture/tex.jhp)
  45. //   'DB1'    DB1 is a repository of most of Haptek's textures (ex: head/mapBaba512.jhp)
  46.  
  47. function SendText(text, box)
  48. {
  49.     // check if optional parameter was passed
  50.     if(box) boxofchoice = box;
  51.     else boxofchoice = G_PluginCurrent;
  52.  
  53.     if(G_PluginOkay) {
  54.         var shortText = text.substr(0, 1400);
  55.         if(G_BrowserNavigator)
  56.             eval("document.embeds['"+G_VFBoxes[boxofchoice].name+"'].HyperText(shortText);");
  57.         if(G_BrowserExplorer)
  58.             eval("document."+G_VFBoxes[boxofchoice].name+".HyperText = shortText;");
  59.     }
  60.       if(G_Debugger)
  61.         window.document.debug.outputbox.value = shortText + "\n" + window.document.debug.outputbox.value;
  62. }
  63.  
  64. function HapQuery(text, box)
  65. {
  66.     // check if optional parameter was passed
  67.     if(box) boxofchoice = box;
  68.     else boxofchoice = G_PluginCurrent;
  69.  
  70.     rtn = "";
  71.     if(G_PluginOkay) {
  72.          var shortText = text.substr(0, 1400);
  73.         if(G_BrowserNavigator)
  74.             eval("rtn = document.embeds['"+G_VFBoxes[boxofchoice].name+"'].QueryPlugin(shortText);");
  75.         if(G_BrowserExplorer)
  76.         {
  77.             eval("document."+G_VFBoxes[boxofchoice].name+".Query = shortText;");
  78.             eval("rtn = document."+G_VFBoxes[boxofchoice].name+".Query");
  79.         }
  80.     }
  81.     if(G_Debugger)
  82.         window.document.debug.outputbox.value = "A: " + rtn + "\nQ: " +shortText +"\n"+ window.document.debug.outputbox.value;
  83.     return rtn;
  84. }
  85.  
  86. function VFBoxSelect(box)
  87. {
  88.     G_PluginCurrent = box;
  89. }
  90.  
  91. function VFBox(x, y, commandfile, code)
  92. {
  93.     G_PluginNum++;
  94.     G_VFBoxes[G_PluginNum]       = new Object();
  95.     G_VFBoxes[G_PluginNum].name  = "vfbox" + G_PluginNum;
  96.     G_VFBoxes[G_PluginNum].path  = 'document';
  97.     G_VFBoxes[G_PluginNum].sizex = x;
  98.      G_VFBoxes[G_PluginNum].sizey = y;
  99.  
  100.     // exception to start the version testing
  101.     if(G_PluginNum == 1) AddToInitQueue("SafeQuery();");
  102.  
  103.     // check to see if an external command file is specified
  104.     if (commandfile)     
  105.         G_VFBoxes[G_PluginNum].scene = JustFile(commandfile);
  106.     else     
  107.         G_VFBoxes[G_PluginNum].scene = 'data\\standard\\standardStartup.hap';
  108.  
  109.     
  110.  
  111.     if (G_PluginOkay) 
  112.     {
  113.         
  114.         if (G_BrowserNavigator) 
  115.         {
  116.             document.write("<EMBED type=\""+G_HAPMimeType+"\" name=\""+ G_VFBoxes[G_PluginNum].name+"\" width=\""+x+"\" height=\""+y+"\" border= \"0\" vspace= \"0\" hspace=\"0\"></EMBED>");
  117.         }
  118.         else 
  119.         {
  120.              document.write("\
  121.             <OBJECT id=\""+ G_VFBoxes[G_PluginNum].name + "\" classid=\""+G_HAPCLSID+"\"\
  122.             align=\"baseline\" border=\"0\" width=\""+x+"\" height=\""+y+"\">\
  123.             </OBJECT>\
  124.             ");
  125.         }
  126.     }
  127.     else 
  128.     {
  129.         if(G_NoVF3Image)
  130.         {
  131.             document.write("<img src="+G_NoVF3Image+" WIDTH="+x+" HEIGHT="+y+">");
  132.         }
  133.         else
  134.         {
  135.             if(G_PlatformOkay == false){document.write(G_ErrorPlatform); return;}
  136.             if(G_BrowserOkay == false){document.write(G_ErrorBrowser); return;}
  137.             if(G_PluginOkay == false){document.write(G_ErrorPluginNone); return;}
  138.             
  139.             document.write("<table width="+x+" height="+y+" border=2 bordercolor=\"#0000ee\"><tr><td><font size=-1>");
  140.             document.write("I'm sorry, you need the latest version of VirtualFriend 3 to see a VirtualFriend character here. you can download it from Haptek, Inc if you click <a href=\"http://vf3.haptek.com\">here</a>");
  141.             document.write("</font></td></tr></table>");
  142.         }
  143.       }
  144.  
  145.     VFBoxSelect(G_PluginNum);
  146.  
  147.     if(commandfile == "none") return;
  148.  
  149.     if(commandfile)    
  150.     {
  151.         if(!code) code = "A";
  152.         commandfile = Backslashify(commandfile);
  153.         selectbox   = "VFBoxSelect("+G_PluginNum+");"
  154.         usefile     = "UseFile('"+commandfile+"', '"+code+"');";
  155.         AddToInitQueue(selectbox);
  156.         AddToInitQueue(usefile);
  157.     }
  158.     else
  159.     {
  160.         AddToInitQueue("SendText('\\\\load [file= "+G_HAP_LangScene+"]')");
  161.         AddToInitQueue("SendText('\\\\load [file= "+G_HAP_LangPose+"]')");
  162.     }
  163.  
  164.  
  165.  
  166. }
  167.  
  168. function UseVFE(DLFN, code)
  169. {
  170.     UseFile(DLFN, code);
  171. }
  172.  
  173. function UseFile(DLFN, code)
  174. {
  175.     if(code)
  176.     {
  177.         if    (code == "A"    )
  178.             DLURL    =    ""        + DLFN;
  179.         else if    (code == "R"    )
  180.             DLURL    =    G_PageRoot    + DLFN;
  181.         else if    (code == "DB1"    )
  182.             DLURL    =    G_DB1        + DLFN;
  183.  
  184.         fn    =    JustFile(DLFN);
  185.         grp    =    GetGrp();
  186.  
  187.         SendText("\\setgrouphypertext[action= [\\load [file= ["+fn+"]]] i0= "+grp+"]");
  188.         SendText("\\setcachedownload[file= ["+DLURL+"] i0= "+grp+"]");
  189.         SendText("\\startcachedownload[i0= "+grp+"]");
  190.     }
  191.     else
  192.     {
  193.         SendText("\\load [file= ["+DLFN+"]]");
  194.     }
  195. }
  196.  
  197. function UseBackground(DLFN, code)
  198. {
  199.     if(code)
  200.     {
  201.         if    (code == "A"    )
  202.             DLURL    =    ""        + DLFN;
  203.         else if    (code == "R"    )
  204.             DLURL    =    G_PageRoot    + DLFN;
  205.         else if    (code == "DB1"    )
  206.             DLURL    =    G_DB1        + DLFN;
  207.  
  208.         fn    =    JustFile(DLFN);
  209.         grp    =    GetGrp();
  210.  
  211.         CleanUp();
  212.         SendText("\\setgrouphypertext[action= [ \\loadbackgrnd [file= ["+fn+"]]] i0= "+grp+"]");
  213.         SendText("\\setcachedownload[file= ["+DLURL+"] i0= "+grp+"]");
  214.         SendText("\\startcachedownload[i0= "+grp+"]");
  215.     }
  216.     else
  217.     {
  218.         SendText("\\loadbackgrnd [file= ["+DLFN+"]]");
  219.     }
  220. }
  221.  
  222. function UseTexture(DLFN, code)
  223. {
  224.     if(code)
  225.     {
  226.         if    (code == "A"    )
  227.             DLURL    =    ""        + DLFN;
  228.         else if    (code == "R"    )
  229.             DLURL    =    G_PageRoot    + DLFN;
  230.         else if    (code == "DB1"    )
  231.             DLURL    =    G_DB1         +DLFN;
  232.  
  233.         fn    =    JustFile(DLFN);
  234.         grp    =    GetGrp();
  235.  
  236.  
  237.         CleanUp();
  238.         SendText("\\setgrouphypertext[action= [ \\settexture [tex= ["+fn+"]]] i0= "+grp+"]");
  239.         SendText("\\setcachedownload[file= ["+DLURL+"] i0= "+grp+"]");
  240.         SendText("\\startcachedownload[i0= "+grp+"]");
  241.     }
  242.     else
  243.     {
  244.         SendText("\\settexture[tex= ["+DLFN+"]]");
  245.     }
  246. }
  247.  
  248. function UseMorph(DLFN, code)
  249. {
  250.     if(code)
  251.     {
  252.         if    (code == "A"    )
  253.             DLURL    =    ""        + DLFN;
  254.         else if    (code == "R"    )
  255.             DLURL    =    G_PageRoot    + DLFN;
  256.         else if    (code == "DB1"    )
  257.             DLURL    =    G_DB1        + DLFN;
  258.  
  259.         fn    =    JustFile(DLFN);
  260.         grp    =    GetGrp();
  261.  
  262.         CleanUp();
  263.         SendText("\\setgrouphypertext[action= [\\load [file= ["+fn+"MorphLoad.hap]]] i0= "+grp+"]");
  264.         SendText("\\setcachedownload[file= ["+DLURL+"/"+fn+"Morph.hap] i0= "+grp+"]");
  265.         SendText("\\setcachedownload[file= ["+DLURL+"/"+fn+"FigExt.hap] i0= "+grp+"]");
  266.         SendText("\\setcachedownload[file= ["+DLURL+"/"+fn+"MorphLoad.hap] i0= "+grp+"]");
  267.         SendText("\\startcachedownload[i0= "+grp+"]");
  268.     }
  269.     else
  270.     {
  271.         SendText("\\setmorph[state="+DLFN+"]");
  272.     }
  273. }
  274.  
  275. function UseNaturalVoice(DLFNwav, DLFNphn, code)
  276. {
  277.     if    (code == "A"    ){
  278.         DLURLwav    =    ""        + DLFNwav;
  279.         DLURLphn    =    ""        + DLFNphn;}
  280.     else if    (code == "R"    ){
  281.         DLURLwav    =    G_PageRoot    + DLFNwav;
  282.         DLURLphn    =    G_PageRoot    + DLFNphn;}
  283.     else if    (code == "DB1"    ){
  284.         DLURLwav    =    G_DB1        + DLFNwav;
  285.         DLURLphn    =    G_DB1        + DLFNphn;}
  286.  
  287.     fnwav    =    JustFile(DLFNwav);
  288.     fnphn    =    JustFile(DLFNphn);
  289.     grp    =    GetGrp();
  290.     
  291.     SendText("\\setgrouphypertext[action= [\\load [file= ["+fnphn+"]] \\start [file=["+fnphn+"]] ] i0= "+grp+"]");
  292.     SendText("\\setcachedownload[file= ["+DLURLwav+"] i0= "+grp+"]");
  293.     SendText("\\setcachedownload[file= ["+DLURLphn+"] i0= "+grp+"]");
  294.     SendText("\\startcachedownload[i0= "+grp+"]");
  295.  
  296. }
  297.  
  298. function StartFile(thefile)
  299. {
  300.     fn    =    JustFile(thefile);
  301.  
  302.     SendText("\\start [file= ["+fn+"]]");
  303. }
  304.  
  305. function LoadFile(thefile)
  306. {
  307.     fn    =    JustFile(thefile);
  308.  
  309.     SendText("\\load [file= ["+fn+"]]");
  310. }
  311.  
  312. function GrabFile(DLFN, code)
  313. {
  314.     if    (code == "A"    )
  315.         DLURL    =    ""        + DLFN;
  316.     else if    (code == "R"    )
  317.         DLURL    =    G_PageRoot    + DLFN;
  318.     else if    (code == "DB1"    )
  319.         DLURL    =    G_DB1        + DLFN;
  320.  
  321.     fn    =    JustFile(DLFN);
  322.     grp    =    GetGrp();
  323.  
  324.     
  325.     SendText("\\setcachedownload[file= ["+DLURL+"] i0= "+grp+"]");
  326.     SendText("\\startcachedownload[i0= "+grp+"]");
  327. }
  328.  
  329.  
  330. function CleanUp(box)
  331. {
  332.     // if the box parameter is passed, it will be chosen
  333.     if(box) VFBoxSelect(box);
  334.     SendText('\\cleanup');
  335. }
  336.  
  337. //////////////////////////////////////////////////////////////
  338. // Material Properties
  339. // i0 == 0  Ambient
  340. // i0 == 1  Diffuse
  341. // i0 == 2  Emissive
  342. // i0 == 3  Specular
  343. // i0 == 4  Specular Power
  344. function SetMaterial(i0, f0, f1, f2, f3) 
  345. {
  346.     SendText("\\setmaterial[i0= " + i0 + " r= " + f0 + " g= " + f1 +" b= " + f2 + "  a= " + f3 + " ]");
  347. }
  348.  
  349. function SetAmbient(r, g, b, a)
  350. {
  351.     SetMaterial(0, r, g, b, a);
  352. }
  353.  
  354. function SetDiffuse(r, g, b, a)
  355. {
  356.     SetMaterial(1, r, g, b, a);
  357. }
  358.  
  359. function SetEmissive(r, g, b, a)
  360. {
  361.     SetMaterial(3, r, g, b, a);
  362. }
  363.  
  364. function SetSpecular(r, g, b, a)
  365. {
  366.     SetMaterial(2, r, g, b, a);
  367. }
  368.  
  369. function SetSpecularPower(power)
  370. {
  371.     SetMaterial(4, power, power, power, power);
  372. }
  373.  
  374. function Rotate(x, y, z, t)
  375. {
  376.   SendText("\\rotate[ x="+x+" y="+y+" z="+z+" t="+t+"]");
  377. }
  378.  
  379.  
  380. function Translate(x, y, z, t)
  381. {
  382.   SendText("\\translate[ x="+x+" y="+y+" z="+z+" t="+t+"]");
  383. }
  384.  
  385. function UseScene_Flavor2(root, code)
  386. {
  387.  
  388.         if    (code == "A"    )
  389.             DLURL    =    ""        + root;
  390.         else if    (code == "R"    )
  391.             DLURL    =    G_PageRoot    + root;
  392.         else if    (code == "DB1"    )
  393.             DLURL    =    G_DB1        + root;
  394.  
  395.         fn    =    JustFile(root);
  396.         grp    =    GetGrp();
  397.  
  398.         SendText("\\setgrouphypertext[action= [\\load [file= ["+fn+"Startup.hap]]] i0= "+grp+"]");
  399.         SendText("\\setcachedownload[file= ["+DLURL+"/"+fn+"BG.jpg] i0= "+grp+"]");
  400.         SendText("\\setcachedownload[file= ["+DLURL+"/"+fn+"FigDef.hap] i0= "+grp+"]");
  401.         SendText("\\setcachedownload[file= ["+DLURL+"/"+fn+"Scene.hap] i0= "+grp+"]");
  402.         SendText("\\setcachedownload[file= ["+DLURL+"/"+fn+"Startup.hap] i0= "+grp+"]");
  403.         SendText("\\setcachedownload[file= ["+DLURL+"/"+fn+"Tex.jhp] i0= "+grp+"]");
  404.         SendText("\\startcachedownload[i0= "+grp+"]");        
  405. }
  406.  
  407. function AddInitFile(box, name)
  408. {
  409.     var loadtext = '\\load [file= '+name+']';
  410.  
  411.     var     load = Backslashify('SendText(\''+loadtext+'\');');
  412.     var      set = Backslashify('VFBoxSelect('+box+');');
  413.  
  414.     G_HAPInitCommands[G_HAPInitCommandsIndex++]=set;
  415.     G_HAPInitCommands[G_HAPInitCommandsIndex++]=load;
  416. }
  417.  
  418. function AddToInitQueue(string, box)
  419. {
  420.         // if a box is selected, it will remain selected after this command
  421.     if(box) G_HAPInitCommands[G_HAPInitCommandsIndex++]='VFBoxSelect('+box+');';
  422.     G_HAPInitCommands[G_HAPInitCommandsIndex++]=string;
  423. }
  424.  
  425. function HAPOnLoadInit()
  426. {
  427.     G_HAPInitInterval = setInterval('HAPOnLoadInit_hidden();', G_HAPInitIntervalTime);
  428. }
  429.  
  430. ///////////////////////////////////////////////////////////////////////
  431. //     EVERYTHING BELOW THIS BOX IS NOT USEFUL TO A WEB DESIGNER     //
  432. ///////////////////////////////////////////////////////////////////////
  433.  
  434. ///////////////////////////////////////////////////////////////////////
  435. // HAPOnLoadInit_hidden()
  436. // HEY! Don't look at this function =), it's called by HAPOnLoadInit()
  437. // It evaluates the onload javascript functions
  438.  
  439. function HAPOnLoadInit_hidden()
  440. {
  441.     clearInterval(G_HAPInitInterval);
  442.  
  443.     for(i = 0; i <= G_HAPInitCommandsIndex; i++)
  444.     {
  445.         eval(G_HAPInitCommands[i]); 
  446.     }
  447. }
  448.  
  449. //////////////////////////////////////////////////////////////
  450. // These are assistant functions
  451.  
  452. function    GetGrp()
  453. {
  454.     G_GrpNum++;
  455.     if (G_GrpNum > G_GrpMax)
  456.         G_GrpNum    =    1;
  457.     return G_GrpNum;
  458. }
  459.  
  460. function    JustPath(s)
  461. {
  462.     delimit    = "/";
  463.     sa    = s.split(delimit);
  464.     rtn    = "";
  465.     for (i = 0; i < sa.length - 1; i++)
  466.         rtn = rtn + sa[i] + delimit;
  467.     return rtn;
  468. }
  469.  
  470. function    JustFile(s)
  471. {
  472.     delimit    = "/";
  473.     sa    = s.split(delimit);
  474.     if (sa.length > 0)
  475.         rtn    = sa[sa.length - 1];
  476.     else
  477.         rtn    = s;
  478.     return rtn;
  479. }
  480.  
  481. function     Backslashify(s)
  482. {
  483.       // Regular Expression to globaly match '\'
  484.       re = /\\/gi
  485.  
  486.     // Replace / with //
  487.       rtn = s.replace(re, '\\\\');
  488.  
  489.       return rtn;
  490. }
  491.  
  492.  
  493. function SafeQuery()
  494. {
  495.   // G_SafeQuery == 0 if there is no plugin
  496.   //                1 if the plugin is old
  497.   //                the version of the plugin if it has querying
  498.  
  499.   if(G_BrowserNavigator)
  500.   {
  501.     if(document.embeds['vfbox1'])
  502.     {
  503.         found = false;
  504.         for(tootoo in document.embeds['vfbox1'])
  505.         {
  506.             if(tootoo == "QueryPlugin")
  507.             {
  508.                 found = true;
  509.                 break;
  510.             }
  511.         }
  512.  
  513.         if(!found)
  514.         {
  515.             for(tootoo in document.embeds['vfbox1'])
  516.             {
  517.                 if(tootoo == "HyperText")
  518.                 {
  519.                     G_SafeQuery = "1";
  520.                     return(true);
  521.                 }
  522.             }
  523.  
  524.             G_SafeQuery = "0";
  525.             alert("Found not thou QueryPlugin!");
  526.             return(false);
  527.         }
  528.         else 
  529.         {
  530.             G_SafeQuery = HapQuery("release", 1);
  531.             return(true);
  532.         }
  533.         found = false;
  534.  
  535.     }
  536.     else
  537.     {
  538.  
  539.         G_SafeQuery = "0";
  540.         return(false);
  541.     }
  542.   }
  543.   if(G_BrowserExplorer)
  544.   {
  545.     if(document.vfbox1)
  546.     { 
  547.         blah = HapQuery("release", 1);
  548.  
  549.         if(blah == "release")
  550.         {
  551.             for(tootoo in document.vfbox1)
  552.             {
  553.                 if(tootoo == "HyperText")
  554.                 {
  555.                     G_SafeQuery = "1";
  556.                     break;
  557.                 }
  558.             }
  559.             if(G_SafeQuery != "1") G_SafeQuery = "0";
  560.             return(false);
  561.         }
  562.         else G_SafeQuery = blah;
  563.     }
  564.     else
  565.     {
  566.         G_SafeQuery = "0";
  567.         return(false);
  568.     }
  569.   }
  570.   return(true);
  571. }
  572.  
  573. function DetectedOldVersion()
  574. {
  575.     var Redirect = "<html><head><title>Old Version of VirtualFriend</title></head><body><center>Haptek has detected an outdated version of VirtualFriend 3. Click <a href=\"javascript:v=window.open('http://vf3.haptek.com');document.close();\">here</a> to download the latest version. Without it, this web page will not work properly.</center></body>";
  576.  
  577.     var w = window.open("", "", "width=200,height=150,resizable=no,status=no");
  578.     w.document.open();
  579.     w.document.write(Redirect);
  580.     w.document.close();
  581.  
  582.     return(false);
  583. }
  584.  
  585. <!--
  586. /////////////////////////
  587. // Global Variables
  588. /////////////////////////
  589. var    G_DownloadName        =    "VirtualFriend 3";
  590. var    G_Platform        =    "Win32";
  591. var    G_PlatformOkay        =    true;
  592. var    G_BrowserExplorer    =    false;
  593. var    G_BrowserNavigator    =    false;
  594. var    G_BrowserVersion    =    "0.0";
  595. var    G_BrowserOkay        =    false;
  596. var    G_BrowserWhyNot        =    "javascript has malfunctioned.";
  597. var    G_PluginOkay        =    false;
  598. var    G_PluginWhyNot        =    "You do not have " + G_DownloadName + " installed.";
  599. var    G_PluginName        =    "VirtualFriend Plugin";
  600. var    G_PluginNameOld        =    "HelloWorld Example Plugin";
  601. var    G_ErrorHandlerOrig    =    null;
  602. var    G_PluginNum        =    0;
  603. var    G_PluginCurrent        =     0;
  604. var     G_PageRoot        =    JustPath(document.location.toString());
  605. var     G_DB1            =    "http://www.haptek.com/db1/";
  606. var     G_GrpNum        =    1;
  607. var     G_GrpMax        =    100;
  608. var    G_VFBoxes        =    new Array;    
  609. var    G_VFBoxSizeX        =    150;
  610. var    G_VFBoxSizeY        =    150;
  611. var     G_Debugger        =     false;
  612. var    G_SafeQuery        =    "0";
  613. var    G_HAPInitInterval;
  614. var    G_HAPInitIntervalTime    =    2000;
  615. var     G_HAPInitCommands     =     new Array;
  616. var     G_HAPInitCommandsIndex     =     0;
  617. var    G_HAP_LangPose        =    "data\\\\standard\\\\standardPose.hap";
  618. var     G_HAP_LangScene        =    "data\\\\standard\\\\standardScene.hap";
  619. var    G_HAPCLSID        =    "CLSID:C6DC0AE5-A7BE-11D2-BDF1-0090271F4931";
  620. var    G_HAPMimeType        =    "fake/mime-type";
  621. var    G_AXCTRL        =    "ACTIVEHAPTEKX.ActiveHaptekXCtrl.1";
  622. var    G_HAPVFLanguage;    // Reserved for Language support
  623. var    G_NoVF3Image;        // This should be set to the image to view if VF3 is not present
  624. var    G_ErrorPlatform        = "VirtualFriend 3 only runs on the Microsoft Windows Platform 95/98/NT";
  625. var    G_ErrorBrowser        = "VirtualFriend 3 required Netscape Navigator 4.03+ or Internet Explorer 4";
  626. var    G_ErrorPluginNone    = "VirtualFriend 3 plugin required";
  627.  
  628.  
  629. if(G_HAPVFLanguage == null)
  630. {
  631. }
  632. if (G_HAPVFLanguage == "gr")
  633. {
  634.   var    G_HAP_LangPose        =    "data\\\\standard\\\\standardPose.hap";
  635.   var     G_HAP_LangScene        =    "data\\\\standard\\\\standardScene_gr.hap";
  636.   var    G_HAPCLSID        =    "CLSID:398F2883-561D-11D3-BDF1-0090272A6ABE";
  637.   var    G_HAPMimeType        =    "fake/mime-gr";
  638.   var    G_AXCTRL        =    "ACTIVEHAPTEKXGR.ActiveHaptekXCtrl.1";
  639. }
  640. if (G_HAPVFLanguage == "sp")
  641. {
  642.   var    G_HAP_LangPose        =    "data\\\\standard\\\\standardPose.hap";
  643.   var     G_HAP_LangScene        =    "data\\\\standard\\\\standardScene_sp.hap";
  644.   var    G_HAPCLSID        =    "CLSID:01A3CFE3-56F7-11d3-BDF1-0090272A6ABE";
  645.   var    G_HAPMimeType        =    "fake/mime-sp";
  646.   var    G_AXCTRL        =    "ACTIVEHAPTEKXSP.ActiveHaptekXCtrl.1";
  647. }
  648. if (G_HAPVFLanguage == "la")
  649. {
  650.   var    G_HAP_LangPose        =    "data\\\\standard\\\\standardPose.hap";
  651.   var     G_HAP_LangScene        =    "data\\\\standard\\\\standardScene_la.hap";
  652.   var    G_HAPCLSID        =    "CLSID:D3EF5F63-56F6-11d3-BDF1-0090272A6ABE";
  653.   var    G_HAPMimeType        =    "fake/mime-la";
  654.   var    G_AXCTRL        =    "ACTIVEHAPTEKXLA.ActiveHaptekXCtrl.1";
  655. }
  656. if (G_HAPVFLanguage == "uk")
  657. {
  658.   var    G_HAP_LangPose        =    "data\\\\standard\\\\standardPose.hap";
  659.   var     G_HAP_LangScene        =    "data\\\\standard\\\\standardScene_uk.hap";
  660.   var    G_HAPCLSID        =    "CLSID:13732363-56F7-11d3-BDF1-0090272A6ABE";
  661.   var    G_HAPMimeType        =    "fake/mime-uk";
  662.   var    G_AXCTRL        =    "ACTIVEHAPTEKXUK.ActiveHaptekXCtrl.1";
  663. }
  664.  
  665. ///////////////////////////////////////////////////////////////////////////////////////////
  666. // Detection Script
  667. // These routines check for the plugin, browser and platform.
  668.  
  669. /////////////////
  670. // DETECT BROWSER
  671.  
  672. MinimalVersionNN    =    "4.03";
  673. MinimalVersionIE    =    "4.0";
  674.  
  675. G_BrowserVersion    =    navigator.appVersion;
  676. G_Platform        =    navigator.platform;
  677.  
  678. if (navigator.appName == "Netscape") {
  679.     navigator.plugins.refresh();
  680.     G_BrowserNavigator    =    true;
  681.     if (G_BrowserVersion    <    MinimalVersionNN) {
  682.         G_BrowserOkay    =    false;
  683.         G_BrowserWhyNot    =    "Your browser is too old. You need at least Navigator " + MinimalVersionNN + ", you are using " + G_BrowserVersion + ".";
  684.         }
  685.     else
  686.         G_BrowserOkay    =    true;
  687.     }
  688. else {
  689.     G_BrowserExplorer    =    true;
  690.     if (G_BrowserVersion    <    MinimalVersionIE) {
  691.         G_BrowserOkay    =    false;
  692.         G_BrowserWhyNot    =    "Your browser is too old. You need at least Explorer " + MinimalVersionIE + ", you are using " + G_BrowserVersion + ".";
  693.         }
  694.     else
  695.         G_BrowserOkay    =    true;
  696.     }
  697.  
  698. if (G_Platform != "Win32") {
  699.     G_PlatformOkay    =    false;
  700.     G_BrowserOkay    =    false;
  701.     G_BrowserWhyNot    =    "This is only implemented for Windows 95, 98, and NT.";
  702.     }
  703.  
  704. // END OF BROWSER DETECTION JAVASCRIPT
  705. // -->
  706. <!--
  707.  
  708. ///////////////////////
  709. // CUSTOM ERROR HANDLER
  710. // This is used to supress the 
  711. // "Automation Server can't create object"
  712. // message box from IE.
  713.  
  714. function ErrorHandler1(msg, url, line)
  715.         {
  716.     if (msg    == "Automation server can't create object")
  717.         return true;
  718.     else
  719.         return false;
  720.     }
  721.  
  722.  
  723. ////////////////////
  724. // CHECK FOR PLUGIN
  725. if (G_BrowserOkay && G_PlatformOkay) {
  726.     if (G_BrowserExplorer) {
  727.  
  728.         //////////////////////////////////////
  729.         // DETECT PLUGIN IN EXPLORER
  730.         //
  731.         G_ErrorHandlerOrig    =    onerror;
  732.         onerror            =    ErrorHandler1;
  733.  
  734.         // IMPORTANT! If the following line generates an error,
  735.         // it will indeed get "handled" by ErrorHandler1,
  736.         // but execution of this script will terminate!
  737.         // That is, execution will resume with the next <SCRIPT>.
  738.  
  739.         // Create default (error present) settings.
  740.         G_PluginOkay    =    true;
  741.         G_PluginWhyNot    =    "You don't have " + G_DownloadName + " installed."
  742.         MyObject    =    new    ActiveXObject(G_AXCTRL);
  743.  
  744.           if (MyObject) {
  745.             // If the code gets past the above line,
  746.             // we know it will also get to here.
  747.             G_PluginOkay    =    true;
  748.             delete MyObject;
  749.               }
  750.           else {
  751.             // This will not ever be called.
  752.               }
  753.         }
  754.     else {
  755.         //////////////////////////////////////
  756.         // DETECT PLUGIN IN NETSCAPE
  757.         //
  758.         if (navigator.plugins[G_PluginName] || navigator.plugins[G_PluginNameOld]) {
  759.             G_PluginOkay    =    true;
  760.             }
  761.         else {
  762.             G_PluginOkay    =    false;
  763.             G_PluginWhyNot    =    "You don't have " + G_DownloadName + " installed."
  764.             }
  765.         }
  766.     }
  767. else {
  768.     G_PluginOkay    =    false;
  769.     G_PluginWhyNot    =    "Can't use VirtualFriend 3 because " + G_BrowserWhyNot;
  770.     }
  771.  
  772. // END OF PLUGIN DETECTION SCRIPT
  773. // -->
  774. <!--
  775. // RESTORE THE OLD ERROR HANDLER.
  776.  
  777. onerror    =    G_ErrorHandlerOrig;
  778.  
  779. // -->
  780.